import Vue from 'vue'
import App from './App'
import store from './store'
import common from '@/common/common.js'
import msgchat from './common/msgchat.js';  
import cuCustom from './colorui/components/cu-custom.vue'
Vue.component('cu-custom',cuCustom)

const msg = (title, duration=1500, mask=false, icon='none')=>{
 if(Boolean(title) === false){
  return;
 }
 uni.showToast({
  title,
  duration,
  mask,
  icon
 });
}
 
Vue.config.productionTip = false
Vue.prototype.$common = common;
Vue.prototype.$msgchat = msgchat;
Vue.prototype.$api = {msg};
Vue.prototype.$store = store;


App.mpType = 'app'

const app = new Vue({
    ...App,
	 store
})
app.$mount();
// var socketTask = uni.connectSocket({
//     url: 'ws://47.52.164.66:7272'
// });
// // var ws = new WebSocket("ws://192.168.0.101:7272");
// // uni.onSocketOpen(function (res) {
// //   console.log('WebSocket连接已打开！');
// // });
// if(uni.getStorageSync('uid')){
// 	console.log(uni.getStorageSync('uid'))
// 	var jsonstr = {
// 		uid:uni.getStorageSync('uid'),
// 		type:"tologin1"
// 	}
// 	var arrstr = JSON.stringify(jsonstr);
// 	uni.onSocketOpen(function (res) {
// 		uni.sendSocketMessage({
// 		  data: arrstr
// 		});
// 	});
// }else{
// 	// uni.navigateTo({
// 	// 	url:'/pages/login/login.vue'
// 	// })
// }


// var ws = new WebSocket("ws://192.168.0.111:7272");
// Vue.prototype.$ws = ws;
// ws.onmessage = function(e) {
// 	 alert("收到消息：" + e.data);
// };
